/**
*      author: Y_Yao
*      created: 2025-02-21 11:55:29
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int n;
int L[N],R[N],l[N],r[N];
int ans[N];


void solve()
{
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        int a,b;
        cin >> a >> b;
        L[i] = a + L[i-1];
        R[i] = b + R[i-1];
        l[i] = a;
        r[i] = b; 
    }
    if(R[n] >= 0 && L[n] <= 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
        return;
    }
    int goal = 0;
    for(int i = n;i >= 1;i--)
    {
        ans[i] = max(goal - R[i-1],l[i]);
        goal = goal - ans[i];
    }

    for(int i = 1;i <= n;i++)
    {
        cout << ans[i] << " ";
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}